
<%--
  Created by IntelliJ IDEA.
  User: 13095
  Date: 2024/10/25
  Time: 16:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set var="path" value="${pageContext.request.contextPath}"></c:set>
<html>
<head>
    <title>已完成订单</title>
   <jsp:include page="inc/inc.jsp"></jsp:include>
</head>

<body>
<header id="site-header" class="fixed-top">
    <section class="w3l-header-4">
        <div class="container">
            <nav class="navbar navbar-expand-lg navbar-light">
                <h1><a class="navbar-brand" href="${path}/user/index">
                    <span>跑腿平台</span>
                </a></h1>
                <button class="navbar-toggler collapsed" type="button" data-toggle="collapse"
                        data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false"
                        aria-label="Toggle navigation">
                    <span class="fa icon-expand fa-bars"></span>
                    <span class="fa icon-close fa-times"></span>
                </button>

                <div class="collapse navbar-collapse" id="navbarNav">
                    <ul class="navbar-nav mx-lg-auto">
                        <li class="nav-item">
                            <a class="nav-link" href="${path}/user/index">首页 </a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="${path}/user/createTask">发起任务</a>
                        </li>
                        <li class="nav-item active">
                            <a class="nav-link" href="${path}/user/historyOrders">我的订单</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="${path}/user/wallet">钱包</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="${path}/user/myAddress">地址管理</a>
                        </li>
                        <li class="nav-item" >
                            <a class="nav-link" href="${path}/user/reviewList">我的评价</a>
                        </li>
                        <li class="nav-item" onclick="logOut()"><a class="nav-link">退出登录</a> </li>
                    </ul>
                    <ul class="navbar-nav search-right mt-lg-0 mt-2">

                         <li class="nav-item"><a href="${path}/user/updateUserInfo"
                                                class="btn btn-primary btn-style d-none d-lg-block btn-style mr-2"><span
                                class="fa fa-phone mr-3" aria-hidden="true"></span>  ${sessionScope.user.phone_number}</a>
                        </li>
                    </ul>

                    <!-- search popup -->
                    <div id="search" class="pop-overlay">
                        <div class="popup">
                            <form action="#" method="GET" class="d-sm-flex">
                                <input type="search" placeholder="Search.." name="search" required="required"
                                       autofocus>
                                <button type="submit">Search</button>
                                <a class="close" href="#url">&times;</a>
                            </form>
                        </div>
                    </div>
                    <!-- /search popup -->
                </div>
                <!-- toggle switch for light and dark theme -->
                <div class="mobile-position">
                    <nav class="navigation">
                        <div class="theme-switch-wrapper">
                            <label class="theme-switch" for="checkbox">
                                <input type="checkbox" id="checkbox">
                                <div class="mode-container">
                                    <i class="gg-sun"></i>
                                    <i class="gg-moon"></i>
                                </div>
                            </label>
                        </div>
                    </nav>
                </div>
            </nav>
        </div>
    </section>
</header>
<section class="w3l-about-breadcrumb text-left">
    <div class="breadcrumb-bg breadcrumb-bg-about py-3">
        <div class="container grid-breadcrumb">
            <ul class="breadcrumbs-custom-path mt-md-2">
                <li><a href="${path}/user/index">主页</a></li>
                <li class="active"><span class="fa fa-angle-double-right mx-2" aria-hidden="true"></span><a href="${path}/user/historyOrders">我的订单</a>
                </li>
                <li class="active"><span class="fa fa-angle-double-right mx-2" aria-hidden="true"></span>已完成订单
            </ul>
        </div>
    </div>
</section>

        <table>
        <tr>
            <th>序号</th>
            <th>订单编号</th>
            <th>任务</th>
            <th>任务地点</th>
            <th>送达地点</th>
            <th>完成时间</th>
            <th>跑腿员</th>
            <th colspan="2">操作</th>
        </tr>
        <c:forEach var="order" items="${requestScope.ordersPageInfo.list}" varStatus="status">
            <tr>
                <td>${status.count}</td>
                <td>${order.orderNumber}</td>
                <td>${order.task.description}</td>
                <td>${order.task.location}</td>
                <td>${order.task.useraddress.address}${order.task.useraddress.doorNumber}</td>
                <td><fmt:formatDate value="${order.task.completedAt}" pattern="yyyy-MM-dd"></fmt:formatDate> </td>
                <td>${order.runner.runnerName}</td>
                <td><c:if test="${order.status==3}">
                    <a href="${path}/user/reviews?taskID=${order.task.id}">去评价</a>
                </c:if>
                <c:if test="${order.status==4}">
                   已评价
                </c:if> </td>
                <td><a href="${path}/user/deleteOrder?id=${order.id}">删除订单</a> </td>
            </tr>
        </c:forEach>
        </table>
        <!-- 分页导航开始 -->
        <div class="pagination" >
            <c:if test="${requestScope.ordersPageInfo.hasPreviousPage}">
                <a href="${path}/user/completedOrderList?page=${requestScope.ordersPageInfo.pageNum - 1}" title="上一页">上一页</a>
            </c:if>
            <c:forEach begin="1" end="${requestScope.ordersPageInfo.pages}" var="pageNum">
                <c:choose>
                    <c:when test="${pageNum == requestScope.ordersPageInfo.pageNum}">
                        <span class="current-page" title="当前页：${pageNum}">${pageNum}</span>
                    </c:when>
                    <c:otherwise>
                        <a href="${path}/user/historyOrders?page=${pageNum}" title="跳转到第 ${pageNum} 页">${pageNum}</a>
                    </c:otherwise>
                </c:choose>
            </c:forEach>
            <c:if test="${requestScope.ordersPageInfo.hasNextPage}">
                <a href="${path}/user/completedOrderList?page=${requestScope.ordersPageInfo.pageNum + 1}" title="下一页">下一页</a>
            </c:if>
        </div>
        <!-- 分页导航结束 -->
        <div style="height: 500px;"></div>
<jsp:include page="inc/footer.jsp"></jsp:include>
</body>
</html>
